Although sensor technologies have allowed us to outperform the human senses of sight, hearing, and touch, the development of artificial noses is significantly behind their biological counterparts. This largely stems from the sophistication of natural olfaction, which relies on both fluid dynamics within the nasal anatomy and the response patterns of hundreds to thousands of unique molecular-scale receptors. We designed a sensing approach to identify volatiles inspired by the fluid dynamics of the nose, allowing us to extract information from a single sensor (here, the reflectance spectra from a mesoporous one-dimensional photonic crystal) rather than relying on a large sensor array. By accentuating differences in the nonequilibrium mass-transport dynamics of vapors and training a machine learning algorithm on the sensor output, we clearly identified polar and nonpolar volatile compounds, determined the mixing ratios of binary mixtures, and accurately predicted the boiling point, flash point, vapor pressure, and viscosity of a number of volatile liquids, including several that had not been used for training the model. We further implemented a bioinspired active sniffing approach, in which the analyte delivery was performed in well-controlled 'inhale-exhale' sequences, enabling an additional modality of differentiation and reducing the duration of data collection and analysis to seconds. Our results outline a strategy to build accurate and rapid artificial noses for volatile compounds that can provide useful information such as the composition and physical properties of chemicals, and can be applied in a variety of fields, including disease diagnosis, hazardous waste management, and healthy building monitoring.