The density of a substance is the ratio of its mass to its volume. Assuming that planets are perfectly spherical, their radius can be used to calculate their volume.
Mercury has a radius of 2435 km and a mass of 3.3 x 10^26 gm. The same numbers can be reported as 0.38 earth radii and 0.055 earth masses, respectively. The latter numbers make use of the earth's radius and mass as an equivalent set of units for measuring properties of other planets.
Using these numbers, the density of Mercury is 5.427 gm/cm^3.
Similarly, Venus has a radius of 6052 km (or 0.95 Earth radii) and a mass of 4.87 x 10^27 gm (or 0.815 Earth Masses). Using these numbers, the density of planet Venus is 5.24 gm/cm^3.