AttributeError: module 'dgl' has no attribute 'from_networkx'

I follow the official guide and write the code below but get the error message
“AttributeError: module ‘dgl’ has no attribute 'from_networkx”
and “AttributeError: ‘DGLGraph’ object has no attribute 'num_edges”

data = load_data(args, os.path.join(os.environ['DATAPATH'], args.dataset))
g = dgl.DGLGraph(data['adj_train'])
print(g.num_edges())

g_nx = dgl.to_networkx(g).to_undirected()
T = nx.maximum_spanning_tree(g_nx)
g = dgl.from_networkx(T)

You need to update to DGL 0.5.0+.