Let the units be your guide...You need to convert the moles to gram by using the molecular weight of whatever you are looking at. The conversion to m^3 from L is 1000, i.e. there are 1000 L in one m^3. So your conversion should look like
Main point is that there is no magic conversion factor like 2.54 or something like that.
example
MW of Air is about 28.84 g/mole
The density of air is 1.2 kg/m^3
so that is 1200 grams/m^3
so that is 1200/28.84 moles /m^3
so that is 1.2/28.84 moles/L