Density and matter are connected by their very definitions.
Density is defined as the amount of mass per unit volume. Basically, density is the amount of matter present in a certain volume of space. The more matter and the smaller the volume of space, the higher the density. Higher density pretty much means more matter squished into the same amount of space.