This is more fundamental than integration by parts - in fact, the strategy is to think about how you prove that integration by parts works. In the one variable case, integration by parts is obtained by integrating the product rule:
$$\frac{d}{dx}(f \cdot g) = \frac{df}{dx} \cdot g + f \cdot \frac{dg}{dx}$$
and using the fundamental theorem of calculus to simplify the left-hand side. Your formula is proved the same way: start with some version of the product rule, integrate it, and uses Stokes' theorem (the $d$-dimensional counterpart of the fundamental theorem of calculus) to simplify. The version of the product rule that we need is:
$$\text{div}(f \nabla g) = \nabla f \cdot \nabla g + f \Delta g$$
Now just integrate everything over $D$. The integral of $\text{div}(f \nabla g)$ over $D$ is equal to the integral of $f \nabla g$ over the boundary of $D$ by Stokes' theorem, so this integral is $0$ since $D$ has no boundary.