Optical simulations of gravitational effects in the Newton–Schrödinger system