Ok, have sense... CommandBasedStatefulKnowledgeSession is more like a wrapper. So, this works, although I´m not sure about so much casting...
CommandBasedStatefulKnowledgeSession commandBasedKSession = (CommandBasedStatefulKnowledgeSession) knowledgeSession;
CommandService commandService = commandBasedKSession.getCommandService();
SingleSessionCommandService singleSessionCommandService = (SingleSessionCommandService) commandService;
StatefulKnowledgeSession statefulKnowledgeSession = singleSessionCommandService.getStatefulKnowledgeSession();
WorkflowProcessInstanceUpgrader.upgradeProcessInstance(statefulKnowledgeSession , processInstance.getId(), targetProcessDefinitionId, mapping);