Machine learning (ML) provides a new surrogate method for investigating groundwater flow dynamics in unsaturated soils. Traditional pure data-driven methods (e.g. deep neural network, DNN) can provide rapid predictions, but they do require sufficient on-site data for accurate training, and lack interpretability to the physical processes within the data. In this paper, we provide a physics and equality-constrained artificial neural network (PECANN), to derive unsaturated infiltration solutions with a small amount of initial and boundary data. PECANN takes the physics-informed neural network (PINN) as a foundation, encodes the unsaturated infiltration physical laws (i.e. Richards equation, RE) into the loss function, and uses the augmented Lagrangian method to constrain the learning process of the solutions of RE by adding stronger penalty for the initial and boundary conditions. Four unsaturated infiltration cases are designed to test the training performance of PECANN, i.e. one-dimensional (1D) steady-state unsaturated infiltration, 1D transient-state infiltration, two-dimensional (2D) transient-state infiltration, and 1D coupled unsaturated infiltration and deformation. The predicted results of PECANN are compared with the finite difference solutions or analytical solutions. The results indicate that PECANN can accurately capture the variations of pressure head during the unsaturated infiltration, and present higher precision and robustness than DNN and PINN. It is also revealed that PECANN can achieve the same accuracy as the finite difference method with fewer initial and boundary training data. Additionally, we investigate the effect of the hyperparameters of PECANN on solving RE problem. PECANN provides an effective tool for simulating unsaturated infiltration.