Siemens AG has agreed to acquire Dotmatics for $5.1 billion as part of a push to provide more artificial intelligence software to life sciences companies.