We propose and demonstrate that optical analog computing of spatial differentiation and edge detection can be realized with a single layer of dielectric metasurface. The optical transfer function for second-order derivation is obtained by engineering the spatial dispersion of electric dipole resonance supported by the silicon nanodisks in the metasurface. Benefiting from this unique mechanism of electric dipole resonance, spatial differentiation can be performed for two dimensions and arbitrary polarization with a large spatial bandwidth and high efficiency at the visible wavelength. Explicitly, we have numerically validated the application with one-dimensional spatial functions as well as an image, and the results show excellent performance. Our study can facilitate the research of optical computing with artificial nanostructures.