Geophysical inversion and machine learning both provide solutions for inverse problems in which we estimate model parameters from observations. Geophysical inversions such as impedance inversion, amplitude-variation-with-offset inversion, and traveltime tomography are commonly used in the industry to yield physical properties from measured seismic data. Machine learning, a data-driven approach, has become popular during the past decades and is useful for solving such inverse problems. An advantage of machine learning methods is that they can be implemented without knowledge of physical equations or theories. The challenges of machine learning lie in acquiring enough training data and selecting relevant parameters, which are essential in obtaining a good quality model. In this study, we compare geophysical inversion and machine learning approaches in solving inverse problems and show similarities and differences of these approaches in a mathematical form and numerical tests. Both methods aid in solving ill-posed and nonlinear problems and use similar optimization techniques. We take reflectivity inversion as an example of the inverse problem. We apply geophysical inversion based on the least-squares method and artificial neural networks as a machine learning approach to solve reflectivity inversion using 2D synthetic data sets and 3D field data sets. A neural network with multiple hidden layers successfully generates the nonlinear mapping function to predict reflectivity. For this inverse problem, we test different L1 regularizers for both approaches. L1 regularization alleviates effects of noise in seismic traces and enhances sparsity, especially in the least-squares method. The 2D synthetic wedge model and field data examples show that neural networks yield high spatial resolution.