Not directly, it is more a polarity problem.
Water is a polar solvent, so it will dissolve well salts and polar molecules. But it will hardly dissolve non-polar ones. The C-C and C-H bonds are not very polar, so they don't dissolve so well in water. For example, water and oil (made of long CH chains) don't mix.
Now, if you add an electric charge (by somehow adding or extracting an electron) onto an insoluble molecule, it will become much more soluble.
In the case of benzene, you only have C-H and C=C bonds. There is no permanent electrical dipole.
) is structurally similar to benzene, with only one CH replaced by N. Yet, pyridine is miscible with water, while benzene is not. The nitrogen atom in pyridine attracts a bit the electrons of the ring
electrical charges appear (negative onto the nitrogen, positive onto the carbons next to it)
it s more water soluble. And as well, pyridine can be protonated by H+
, which gives it a positive charge and makes it even more water soluble.