The most general approach is to use pretty simple algebra. Start with the density definition:
d = m/V
d for density, m for mass, V for volume. Now, you need mass - so you solve for mass:
m = d*V
You need volume, you solve for volume:
V = m/d
This approach works also in othe situations, like concentration calculations, speed-time-distance and so on. Note that the final formula can be checked with units as Custos signalled.