The problem with NK Yu's diagram is that the bond rotation is unnecessary to obtain the correct conformation for epoxide formation. The epoxidation and the bromination/base give the same product and both processes are stereospecific. (Z)-Butene (1) gives the cis-oxirane 2 while (E)-butene affords the trans-oxirane (not shown).
Peracid epoxidation adds oxygen to either face of the π-system of (Z)-butene to provide meso-oxirane 2. Bromination of 1 affords an intermediate meso-bromonium ion 3 by the same type of addition as was seen in the peroxidation. When hydroxide effects an SN2 (blue arrow) inversion of stereochemistry occurs (R --> S), the S,S-bromohydrin 3 is formed. With equal probability the path of the red arrow leads to the R,R-enantiomer 4. Deprotonation of the racemic bromohydrin leads to a second inversion of stereochemistry to form meso-oxirane 2, i.e., R,R --> R,S and S,S --> R,S. The commonality here is that direct, peracid epoxidation involves no inversions of stereochemistry while the bromination/base route involves two inversions of stereochemistry. The bottom line is that an even number of inversions, zero being considered even, produces the same stereochemistry.