Let $E\xrightarrow{\pi} B$ be an oriented sphere bundle of dimension $n$. Then transgression of a chosen fibre generator yields a class in $H^{n+1}(B,\mathbb{Z})$. Such a class also leads to an isomorphism of the nth cohomology of $R\pi_*\underline{\mathbb{Z}}$ with $\underline{\mathbb{Z}}$, which gives a class via the yoneda construction of $Ext$ in $Ext^{n+1}(\underline{\mathbb{Z}}, \underline{\mathbb{Z}})\cong H^{n+1}(B,\mathbb{Z})$, where this $Ext$ is in the category of sheaves over $B$.
My question is, are these two classes the same? If it’s easier to use differential forms, I’m happy to assume that all spaces are smooth manifolds.