BMW is among automakers forming a data-sharing alliance with German industrial and technology companies including SAP, Siemens, Robert Bosch and ZF Friedrichshafen as Europe's biggest economy fights to recover ground lost to U.S. and Chinese competition.