This is a quirk in Matlab's HDF5 reader routines. (I think the reasoning behind this behavior is: the data is in C-order in the binary file, and Matlab arrays are in Fortran order, so they should report the data as transposed rather than go reordering it.)
If you inspect the file created by Python with HDF5 tools, the dimensions are what they should be:
$ h5ls test.h5 mydataset Dataset {10, 30}