By using deep observations of clusters of galaxies, it has been recently found that the projected stellar mass density closely follows the projected total (dark and baryonic) mass density within the innermost ∼140 kpc. In this work, we aim to test these observations using the Cluster-EAGLE simulations, comparing the projected densities inferred directly from the simulations. We compare the iso-density contours using the procedure of Montes & Trujillo, and find that the shape of the stellar mass distribution follows that of the total matter even more closely than observed, although their radial profiles differ substantially. The ratio between stellar and total matter density profiles in circular apertures shows a slope close to −1, with a small dependence on the cluster's total mass. We propose an indirect method to calculate the halo mass and mass density profile from the radial profile of the intracluster stellar mass density.