'Construct a spec from YAML.
Parameters:
data -- a nested dict/list data structure read from YAML or JSON.'

@staticmethod
def from_dict(data):

    nodes = data['spec']
    dep_list = [Spec.from_node_dict(node) for node in nodes]
    if (not dep_list):
        raise SpecError('YAML    spec    contains    no    nodes.')
    deps = dict(((spec.name, spec) for spec in dep_list))
    spec = dep_list[0]
    for node in nodes:
        name = next(iter(node))
        if ('dependencies' not in node[name]):
            continue
        yaml_deps = node[name]['dependencies']
        for (dname, dhash, dtypes) in Spec.read_yaml_dep_specs(yaml_deps):
            deps[name]._dependencies[dname] = DependencySpec(deps[name], deps[dname], dtypes)
    return spec
