public static function fromMetadataDriver(MappingDriver $omDriver)
    {
        if ($omDriver instanceof MappingDriverChain) {
            $drivers = array();
            foreach ($omDriver->getDrivers() as $nestedOmDriver) {
                $drivers[] = self::fromMetadataDriver($nestedOmDriver);
            }

            return new DriverChain($drivers);
        }

        if ($omDriver instanceof DoctrineAnnotationDriver) {
            return new AnnotationDriver($omDriver->getReader());
        }

        if ($omDriver instanceof DoctrineFileDriver) {
            $reflClass = new \ReflectionClass($omDriver);

            $driverName = $reflClass->getShortName();
            if ($omDriver instanceof SimplifiedYamlDriver || $omDriver instanceof SimplifiedXmlDriver) {
                $driverName = str_replace('Simplified', '', $driverName);
            }

            $class = 'Prezent\\Doctrine\\Translatable\\Mapping\\Driver\\' . $driverName;

            if (class_exists($class)) {
                return new $class($omDriver->getLocator());
            }
        }

        throw new \InvalidArgumentException('Cannot adapt Doctrine driver of class ' . get_class($omDriver));
    }