A proper treatment of electron correlation effects is indispensable for accurate simulation of compounds. Various post-Hartree-Fock methods have been adopted to calculate correlation energies of chemical systems, but time complexity usually prevents their usage in a large scale. Here, we propose a density functional approximation, based on machine learning using neural networks, which can be readily employed to produce results comparable to second-order Møller-Plesset perturbation (MP2) ones for organic compounds with reduced computational cost. Various systems have been tested and the transferability across basis sets, structures, and nuclear configurations has been evaluated. Only a small number of molecules at the equilibrium structure has been needed for the training, and generally less than 5% relative error has been achieved for structures outside the training domain and systems containing about 140 atoms. In addition, this approach has been applied to make predictions on correlation energies of nuclear configurations extracted from density functional theory-based molecular dynamics trajectories with only one or two structures as training data.