Let $M$ be a complex manifold and $E\to M$ be a holomorphic vector bundle. Let $\nabla:E\to E\otimes A_M^1$ be a flat connection, where $A_M^1$ stands for the sheaf/complex vector bundle of smooth 1-forms. If $\nabla$ compatible with the holomorphic structure, i.e., $\nabla^{0,1}=\bar{\partial}^E$, then is $\nabla$ a holomorphic connection (i.e., $\nabla:E\to E\otimes \Omega_M^1$, where $\Omega_M^1$ stands for the sheaf/holomorphic vector bundle of holomorphic 1-forms)?
Without flatness, the two notions are different, cf. p.179 of Complex Geometry An Introduction by Daniel Huybrechts.
As I see it, by smooth Riemann-Hilbert correspondence (Thm. C.4.3 of Period Mappings and Period Domains), $L:=\ker(\nabla)$ is a local system with $L\otimes_{\mathbb{C}}C_M^{\infty}=E$ as a complex vector bundle and $\nabla=Id_L\otimes d$. Then $\ker(\nabla)\otimes_{\mathbb{C}}O_M$ gives a holomorphic structure on $E$ with respect to which $\nabla$ is a holomorphic connection. But I am not sure if this new holomorphic structure coincides with the original one on $E$.
Another try: take a local holomorphic frame $\{e_1,\dots,e_r\}$ of $E$, and denote the local connection matrix smooth 1-form by $\Omega$. As $\nabla^{0,1}=\bar{\partial}^E$, then $\Omega^{0,1}=0$. By flatness, $d\Omega+\Omega\wedge \Omega=0$. Consider the $(1,1)$ part of it, we get $\bar{\partial}\Omega=0$, i.e., $\Omega$ is a holomorphic form. This shows that $\nabla$ is holomorphic.