We present a spatially resolved study of the relation between dust and metallicity in the nearby spiral galaxies M101 (NGC 5457) and NGC 628 (M74). We explore the relation between the chemical abundances of their gas and stars with their dust content and their chemical evolution. The empirical spatially resolved oxygen effective yield and the gas to dust mass ratio (GDR) across both disc galaxies are derived, sampling one dex in oxygen abundance. We find that the metal budget of the NGC 628 disc and most of the M101 disc appears consistent with the predictions of the simple model of chemical evolution for an oxygen yield between half and one solar, whereas the outermost region (R<0.8R25) of M101 presents deviations suggesting the presence of gas flows. The GDR-metallicity relation shows a two slopes behaviour, with a break at 12+log(O/H)~8.4, a critical metallicity predicted by theoretical dust models when stardust production equals grain growth. A relation between GDR and the fraction of molecular to total gas, Sigma(H2)/Sigma(gas) is also found. We suggest an empirical relationship between GDR and the combination of 12+log(O/H), for metallicity, and Sigma(H2)/Sigma(gas), a proxy for the molecular clouds fraction. The GDR is closely related with metallicity at low abundance and with Sigma(H2)/Sigma(gas) for higher metallicities suggesting ISM dust growth. The ratio Sigma(dust)/Sigma(star) correlates well with 12 + log(O/H) and strongly with log(N/O) in both galaxies. For abundances below the critical one, the stardust production gives us a constant value suggesting a stellar dust yield similar to the oxygen yield.