The influence of the central depression in the density distribution of spherical superheavy nuclei on the shell structure is studied within the relativistic mean field theory. Large depression leads to the shell gaps at the proton Z=120 and neutron N=172 numbers, while flatter density distribution favors N=184 for neutrons and leads to the appearance of a Z=126 shell gap and to the decrease of the size of the Z=120 shell gap. The correlations between the magic shell gaps and the magnitude of central depression are discussed for relativistic and non-relativistic mean field theories.