def METHOD_NAME(cls, labels: Dict[str, str]) -> Metadata:
    """ Get manifest from image labels.
    Args:
        labels: key, value string pairs
    Returns:
        Metadata
    Raises:
        MetadataError
    """
    metadata_dict = translate_plain_to_tree(labels)
    try:
        sonic_metadata = metadata_dict['com']['azure']['sonic']
    except KeyError:
        raise MetadataError('No metadata found in image labels')
    try:
        manifest_string = sonic_metadata['manifest']
    except KeyError:
        raise MetadataError('No manifest found in image labels')
    try:
        manifest_dict = json.loads(manifest_string)
    except (ValueError, TypeError) as err:
        raise MetadataError(f'Failed to parse manifest JSON: {err}')
    components = {}
    if 'versions' in sonic_metadata:
        for component, version in sonic_metadata['versions'].items():
            try:
                components[component] = Version.parse(version)
            except ValueError as err:
                raise MetadataError(f'Failed to parse component version: {err}')
    labels_yang_modules = sonic_metadata.get('yang-module')
    yang_modules = []
    if isinstance(labels_yang_modules, str):
        yang_modules.append(labels_yang_modules)
        log.debug("Found one YANG module")
    elif isinstance(labels_yang_modules, dict):
        yang_modules.extend(labels_yang_modules.values())
        log.debug(f"Found YANG modules: {labels_yang_modules.keys()}")
    else:
        log.debug("No YANG modules found")
    return Metadata(Manifest.marshal(manifest_dict), components, yang_modules)