Gears and bearings are important components in rotating machinery and are crucial for the safety and operation of the whole mechanical system. Intelligent fault diagnosis methods based on deep-learning algorithms have undergone rapid development in recent years. Despite this, integrating fault features in a deep network construction remains a challenge for intelligent fault diagnosis of rotating machinery. In this paper, a novel impact feature extraction deep neural network (IFE-DN) is proposed for intelligent gear and bearing fault diagnosis. An improved three-layer Laplace wavelet kernel convolutional neural network (LW-CNN), where the Laplace wavelet kernel is designed in the first convolutional layer, is constructed to extract and enhance the impact features in the vibration signal. Using a visualized heat map, the physical meaning of the LW-CNN’s extracted features is explained and the interpretability of the network model is enhanced. The wavelet function selection in the deep neural network is also discussed. The extracted features are transferred to a primary capsule layer and a digital capsule layer. With a feature vector converting process and dynamic routing algorithm, more detailed features are optimized and the fault types are classified. Four experimental data sets from different laboratories are used to verify the performance of the proposed model, and t-distributed stochastic neighbour embedding is carried out to visually analyze the extracted features in different layers. The results of the analysis of gear and bearing faults of different types and defect sizes show that the IFE-DN presents significant accuracy and satisfactory generalization ability.