A question about curvature for linear connections

Let $M$ be a manifold and $\pi : E \to M$ a rank $n$ vector bundle on $M$. We can define a connection on $E$ in two ways:

• We can specify the covariant derivatives $\nabla_X s$ or
• We can choose a connection form $\Phi \in \Omega^1({\rm Fr} \, E) \otimes \mathfrak{gl}_n$ where ${\rm Fr} \, E$ is the frame bundle.

I have seen both of the following called curvature:

• $R(X,Y,s) = \nabla_X \nabla_Y s - \nabla_Y \nabla_X s - \nabla_{[X,Y]} s$
• $\Omega = d \Phi + \frac{1}{2} [\Phi,\Phi]$

The first is an ${\rm End}(E)$-valued 2-form on $M$ and the second is a $\mathfrak{gl}_n$-valued 2-form on ${\rm Fr} \, E$

Question 1: How are $R$ and $\Omega$ related?

By direct computation, if $\Omega = 0$, then the horizontal subbundle is integrable, so the connection is flat. A slightly more concrete question than question 1 is

Question 2: Why does $R = 0$ imply that the connection is flat? (By flat, I mean that the horizontal subbundle $H \subseteq T ({\rm Fr} \, E)$ is integrable)

Concerning question 1: Basically, $\Omega$ and $R$ are the same: $R$ is a 2-form on $M$ with values in the endomorphism bundle of $E,$ but the endomorphism bundle is the bundle associated to adjoint representation. Hence, after pulling back to $Fr E$ you can think of $R$ as a horizontal equivariant 2-form, and this 2-form is exactly $\Omega.$
Question 2: $\Omega$ measures the integrability of the horizontal distribution: if you compute $\Omega(X,Y)$ for horizontal vector fields (which are by definition in the kernel of $\Phi$) all what remains is $$\Omega(X,Y)=-\Phi([X,Y]).$$ If $R$ vanishes, $\Omega$ vanishes, and hence the commutator of horizontal fields is horizontal, again.