The first example uses “boolean array indexing” while the second uses plain indexing as described in the numpy advanced indexing docs 2.
If you call print('mask_b', data[mask_b.byte()]), you’ll get the same result.