Electroencephalography (EEG) inverse problem is a typical inverse problem, in which the electrical activity within the brain is reconstructed based on EEG data collected from the scalp electrodes. In this paper, the four-layer concentric head model is used for simulation firstly, four deep neural network models including a multilayer perceptron (MLP) model and three convolutional neural networks (CNNs) are adopted to solve EEG inverse problem based on equal current dipole (ECD) model. In the simulations, 100,000 samples are generated randomly, of which 60% are used for network training and 20% are used for cross-validation. Eventually, the generalization performance of the model using the optimal function is measured by the errors in the rest 20% testing set. The experimental results show that the absolute error, relative error, mean positioning error and standard deviation of the four models are extremely low. The CNN with 6 convolutional layers and 3 pooling layers (CNN-3) is the best model. Its absolute error is about 0.015, its relative error is about 0.005, and its dipole position error is 0.040±0.029 cm. Furthermore, we use CNN-3 for source localization of the real EEG data in Working Memory. The results are in accord with physiological experience. The deep neural network method in our study needs fewer calculation parameters, takes less time, and has better positioning results.