Short answer. Because pressure is approximately constant across a thin boundary layer.
Some details. You can connect velocity and pressure in different points of a fluid belonging to the same irrotational region (i.e. region where vorticity is zero, $\boldsymbol{\omega}(\mathbf{r},t) = \mathbf{0}$), like the points $A_1$ and $A_2$ in the figure above,
$$\frac{1}{2}\rho V_1^2 + P_{1} = \frac{1}{2}\rho V_2^2 + P_{2} $$.
For sufficiently high, thin boundary layer develops on the walls of the pipe. Pressure is approximately constant across the boundary layer, as you can derive from some mathematical models of the boundary layer, like Prandtl equations.
Thus, you can say that the pressure measured by the sensors at wall equals the pressure in the irrotational flow at the same sections
$$P_{wall,1} = P_1 \qquad , \qquad P_{wall,2} = P_2 \ .$$
Some other details - more important than you may think. The flow shown in the picture of your answer, with the developed Poiseuille parabolic velocity profile, is not irrotational. Thus you can't use Bernoulli's theorem!