Connecting two PCBs with different headers
Create a wiring harness using the proper mating connectors for each side.  You can then route any pin on the first connector to any pin on the second connector.

Here are some connectors that would probably work...

XG5M-5035-N, 25 pin x 2 row, 0.1" pitch, female, $5.83 on Digikey
http://www.digikey.com/product-detail/en/omron-electronics-inc-emc-div/XG5M-5035-N/Z5274-ND/2627561

http://www.omron.com/ecb/products/pdf/en-icdw.pdf