We analyse the dust-to-gas mass ratio (DGR) in nearby galaxies on kiloparsec scales. We focus on their dependence on metallicity and the CO-to-H2 conversion factor, αco. We use a sample of 25 nearby galaxies from SINGS and combine our data with CO (2-1) and H I observations from the HERACLES and THINGS surveys. We implement a Hierarchical Bayesian method to derive the dust mass via fitting the infrared data from 100 to 500 μm with a single modified blackbody. We find that the DGR-metallicity relation follows a power law and we study its strong dependency on the conversion factor αco. Our results indicate a strong connection between interstellar dust and gas. The resolved DGR-metallicity relation cannot be represented with a single power law. The scatter in this relation shows the strong impact of several processes that take place in every galaxy.